package com.st.controller;


import com.st.entity.*;
import com.st.service.IAttractionsService;
import com.st.service.IOrderService;
import com.st.service.IScenicEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/scenicEvaluation")
public class ScenicEvaluationController {

    @Autowired
    private IAttractionsService iAttractionsService;
    @Autowired
    private IScenicEvaluationService iScenicEvaluationService;

    @PostMapping("/delOne")
    public Result delByIds(@RequestBody ScenicEvaluation scenicEvaluation){
        return iScenicEvaluationService.delOne(scenicEvaluation);
    }

    @PostMapping("/attractionList")
    public List<Attractions> findAll(){
        return iAttractionsService.findAll1();
    }
    @PostMapping("/search")
    public PageResult<ScenicEvaluation> search(@RequestBody PageDTO<ScenicEvaluation> pageDTO){
        if (pageDTO == null) {
            pageDTO.setPage(1);
            pageDTO.setLimit(5);
        }
        PageResult<ScenicEvaluation> scenicEvaluations = iScenicEvaluationService.findScenicEvaluations(pageDTO);
        return scenicEvaluations;
    }
}
